<?php
namespace Home\Controller;

class AboutController extends AuthController {
    public function index(){
        $upload = new \Think\Upload();// 实例化上传类
        $upload->maxSize   =     3145728 ;// 设置附件上传大小
        $upload->exts      =     array('jpg', 'gif', 'png', 'jpeg');// 设置附件上传类型
        $upload->rootPath  =      './Public/'; // 设置附件上传根目录
        $upload->savePath  =      '/Uploads/'; // 设置附件上传（子）目录
        $info   =   $upload->upload();
        $array = array();
        if ($info) {
            foreach ($info as $val) {
                $array[] = $val['savepath'] . $val['savename'];
            }
        }
        $post = I('post.');
        $post['about_img']=$array[0];
        $post['about_time']=date("Y/m/d");
		// dump($post['about_img']);
        // dump($post);
        if(!$info) {// 上传错误提示错误信息
            //$this->error($upload->getError());
        }else{// 上传成功 获取上传文件信息D
            foreach($info as $file){
                $about=D('about');
                if($about->add($post)) {
                   //dump($post);
                   // $this->success('感谢你的宝贵意见，祝你生活愉快','index');
                }
            }
        }

        $this->display();
    }

}